package demo10super详解;

//学生 is 人 ：派生类 子类
//子类继承了父类，就会拥有父类的全部方法
public class Student extends Person {

    public Student() {
        //隐藏代码：调用了父类的无参构造,重写有参，一般默认把有参构加上

        //this("aaa");
        //调用父类的构造器，必需要在子类构造器的第一行
        super("你好啊 ");
        System.out.println("Student无参构造实行了");
    }

    //Ctrl + h
    private String name = "dabing";

    @Override
    public void print(){
        System.out.println("Student");
    }

    public Student(String name) {
        this.name = name;
    }

    public void test1() {
        print();
        this.print();
        super.print();
    }

    public void test(String name) {
        System.out.println(name);//龚靖雯
        System.out.println(this.name);//dabing
        System.out.println(super.name);//gongjingwen
    }
}
